<?php
use yii\helpers\Html;
//$context=$this->context;
$post=\Yii::$app->session->getFlash('post');
?>
<?php $this->beginBlock('title'); ?>
    <?php if(isset($model['id'])):?>编辑<?php else:?>新增<?php endif;?>友情链接
<?php $this->endBlock();?>
<?php $this->beginBlock('breadcrumb'); ?>
<li><a href="<?php echo \Yii::$app->urlManager->createUrl('/friend-links/index')?>">友情链接</a></li>
<li class="active"><a href="<?php echo \Yii::$app->urlManager->createUrl('/friend-links/edit',['id'=>isset($model['id'])?$model['id']:0]);?>"><?php if(isset($model['id'])):?>编辑<?php else:?>新增<?php endif;?>友情链接</a></li>
<?php $this->endBlock();?>

<div class="row">
	<div class="col-sm-12">
		<section class="panel">
			<div class="panel-body">
				<div class="form">
					<form class="cmxform form-horizontal tasi-form" method="post" action="<?php echo \Yii::$app->urlManager->createUrl('/friend-links/save');?>">
						<div class="form-group">
							<label for="name" class="control-label col-lg-2">链接名称</label>
							<div class="col-lg-10">
                               	<input class="form-control" id="name" name="name" value="<?php if(isset($post['name'])){ echo $post['name'];}else{ echo Html::encode(isset($model['name'])?$model['name']:''); }?>" type="text" required />
                            </div>
						</div>
                        <div class="form-group">
                            <label for="link_url" class="control-label col-lg-2">链接URL</label>
                            <div class="col-lg-10">
                                <input class="form-control " id="link_url" type="text" value="<?php if(isset($post['link_url'])){ echo $post['link_url'];}else{ echo Html::encode(isset($model['link_url'])?$model['link_url']:''); }?>" name="link_url" required />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="sort" class="control-label col-lg-2">排序值</label>
                            <div class="col-lg-10">
                                <input class="form-control " id="sort" type="text" name="sort" value="<?php if(isset($post['sort'])){ echo $post['sort'];}else{ echo Html::encode(isset($model['sort'])?$model['sort']:100); }?>" required />
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-offset-2 col-lg-10">
                                <input type="hidden" name="_csrf" id="_csrf" value="<?=\Yii::$app->request->csrfToken; ?>" />
        						<?php if(isset($model['id'])):?><input type="hidden" name="id" value="<?=$model['id'];?>" /><?php endif;?>
                                <button class="btn btn-success" type="submit"> 保存</button>
                                <button class="btn btn-default" type="button" onclick="javascript:history.go(-1)"> 取消</button>
                            </div>
                        </div>
                    </form>
                </div>
			</div>
		</section>
	</div>
</div>